<template>
  <a-card :bordered="false" class="card-area">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <!-- 搜索区域 -->
      <a-form layout="inline">
        <a-row :gutter="24">
          <a-col :md="8" :sm="8">
            <a-form-item label="项目名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <a-input placeholder="请输入项目名称查询" v-model="queryParam.systemName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="8">
            <a-form-item label="机构" style="width: 300px">
              <j-select-depart v-model="queryParam.office"/>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="12">
            <a-form-item label="创建时间" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <j-date v-model="queryParam.createTime" :showTime="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择创建时间" ></j-date>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :md="12">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            <a-button type="primary" style="margin-left: 5%" icon="download" @click="handleExportXlsTemplate('历史数据')">导出模板</a-button>
            <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" style="margin-left: 5%">
              <a-button type="primary"  icon="import">导入</a-button>
            </a-upload>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;margin-top: 10px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <!-- 操作按钮区域 -->
<!--      <div class="table-operator"  style="margin-top: 5px">-->
<!--        <a-button type="primary" style="margin-left: 20%" @click="searchQuery">查询</a-button>-->
<!--        <a-button type="primary" style="margin-left: 5%" icon="download" @click="handleExportXls('台账记录')">导出</a-button>-->
<!--        <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" style="margin-left: 5%">-->
<!--          <a-button type="primary"  icon="import">导入</a-button>-->
<!--        </a-upload>-->
<!--      </div>-->
<!--      <cloud-list-edit-modal ref="modalForm" @ok="modalFormOk"></cloud-list-edit-modal>-->

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">


        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->


  </a-card>
</template>

<script>
   import cloudListEditModal from './cloudListEditModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JDate from '@/components/jeecg/JDate'
   import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  export default {
    name: 'list',
    mixins:[JeecgListMixin],
    components: {
      // RoleModal,
      cloudListEditModal,
      JDate,
      JSelectDepart
    },
    data () {
      return {
        queryParam: {
          projectName:'',
          officeId:'',
          createTime:''
        },
        pagination: {
          total: 0,
          pageSize: 10,//每页中显示10条数据
          showSizeChanger: true,
          pageSizeOptions: ["10", "20", "50", "100"],//每页中显示的数据
          showTotal: total => `共有 ${total} 条数据`,  //分页中显示总的数据
        },
        columns:[
          {
            title: '机构名称',
            align:"center",
            dataIndex: 'office_dictText'
          },
          {
            title: '项目名称',
            align:"center",
            dataIndex: 'project'
          },
          {
            title: '电源状态',
            align:"center",
            dataIndex: 'powerStatus_dictText'
          },
          {
            title: '状态',
            dataIndex: 'status_dictText',
            align:"center",
          },
          {
            title: 'ip',
            dataIndex: 'ip',
            align:"center",
          },
          {
            title: '硬盘大小',
            dataIndex: 'diskSize',
            align:"center",
          },
          {
            title: '已用空间',
            dataIndex: 'usedSize',
            align:"center",
          },
          {
            title: '主机cpu',
            dataIndex: 'mainCpuMhz',
            align:"center",
          },
          {
            title: '主机内存',
            dataIndex: 'mainMemorySize',
            align:"center",
          },
          {
            title: '客户机内存使用百分比',
            dataIndex: 'clientMemoryPercent',
            align:"center",
          },
          {
            title: '内存大小',
            dataIndex: 'clientMemorySize',
            align:"center",
          },
          {
            title: 'cpu个数',
            dataIndex: 'cpuNumber',
            align:"center",
          },
          {
            title: '警报操作',
            dataIndex: 'alarmHandle_dictText',
            align:"center",
          },
          {
            title: '上次备份信息',
            dataIndex: 'nbLastBackup',
            align:"center",
          },
          {
            title: '备注',
            dataIndex: 'remark',
            align:"center",
          },
          {
            title: '日期',
            dataIndex: 'createTime',
            align:"center",
          }
          // {
          //   title:'操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   scopedSlots: { customRender: 'action' },
          // }
        ],
        url: {
          list: "/governmentCloud/cloudHistoryList",
         // list: "/jinan/standingBook/list",
          delete: "/jinan/standingBook/delete",
          // deleteBatch: "/sys/role/deleteBatch",
          exportXlsUrl: "/jinan/standingBook/exportXls",
          importExcelUrl: "governmentCloud/importExcel",
          exportXlsUrlTemplate: "/governmentCloud/exportXlsTemplate",
          // importExcelUrl: "sys/role/importExcel",
        },
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    }
  }
</script>


<style scoped>
  @import '~@assets/less/common.less'
</style>